package test.netui;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JTextArea;

import javax.swing.WindowConstants;
import javax.swing.SwingUtilities;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class MainFrame extends javax.swing.JFrame {
	private static final long serialVersionUID = 1L;
	
	private JPanel receivePanel;
	private JPanel receiveSettingPanel;
	private JTextArea receiveDisplayTextArea;
	private JButton SentButton;
	private JTextArea sentTextArea;
	private JRadioButton BinaryRadioButton;
	private JRadioButton HexRadioButton;
	private JPanel receiveDisplayPanel;
	
	private ButtonGroup formatGroup;
	private JRadioButton stringRadioButton;
	
	private JPanel sentSettingPanel;
	private JPanel SentInputPanel;
	private JPanel sentjPanel;

	/**
	* Auto-generated main method to display this JFrame
	*/
	public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				MainFrame inst = new MainFrame();
				inst.setLocationRelativeTo(null);
				inst.setVisible(true);
			}
		});
	}
	
	public MainFrame() {
		super();
		initGUI();
	}
	
	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			{
				receivePanel = new JPanel();
				BorderLayout receiveJPanelLayout = new BorderLayout();
				receivePanel.setLayout(receiveJPanelLayout);
				getContentPane().add(receivePanel, BorderLayout.CENTER);
				{
					receiveSettingPanel = new JPanel();
					FlowLayout receiveSettingPanelLayout = new FlowLayout();
					receiveSettingPanelLayout.setAlignment(FlowLayout.LEFT);
					receiveSettingPanel.setLayout(receiveSettingPanelLayout);
					receivePanel.add(receiveSettingPanel, BorderLayout.NORTH);
					receiveSettingPanel.setPreferredSize(new java.awt.Dimension(392, 27));
					receiveSettingPanel.add(getStringRadioButton());
					receiveSettingPanel.add(getHexRadioButton());
					receiveSettingPanel.add(getBinaryRadioButton());
				}
				{
					receiveDisplayPanel = new JPanel();
					receivePanel.add(receiveDisplayPanel, BorderLayout.CENTER);
					BorderLayout receiveSettingJPanelLayout = new BorderLayout();
					receiveDisplayPanel.setLayout(receiveSettingJPanelLayout);
					receiveDisplayPanel.add(getReceiveDisplayTextArea(), BorderLayout.CENTER);
				}
			}
			{
				sentjPanel = new JPanel();
				BorderLayout sentjPanelLayout = new BorderLayout();
				sentjPanel.setLayout(sentjPanelLayout);
				getContentPane().add(sentjPanel, BorderLayout.SOUTH);
				sentjPanel.setPreferredSize(new java.awt.Dimension(392, 94));
				{
					sentSettingPanel = new JPanel();
					sentjPanel.add(sentSettingPanel, BorderLayout.NORTH);
					sentSettingPanel.setPreferredSize(new java.awt.Dimension(392, 27));
				}
				{
					SentInputPanel = new JPanel();
					BorderLayout SentInputPanelLayout = new BorderLayout();
					SentInputPanel.setLayout(SentInputPanelLayout);
					sentjPanel.add(SentInputPanel, BorderLayout.CENTER);
					SentInputPanel.setPreferredSize(new java.awt.Dimension(392, 33));
					SentInputPanel.add(getSentTextArea(), BorderLayout.CENTER);
					SentInputPanel.add(getSentButton(), BorderLayout.EAST);
				}
			}
			pack();
			setSize(400, 300);
		} catch (Exception e) {
		    //add your error handling code here
			e.printStackTrace();
		}
	}
	
	private ButtonGroup getFormatGroup() {
		if(formatGroup == null) {
			formatGroup = new ButtonGroup();
		}
		return formatGroup;
	}
	
	private JRadioButton getStringRadioButton() {
		if(stringRadioButton == null) {
			stringRadioButton = new JRadioButton();
			stringRadioButton.setText("\u5b57\u7b26\u4e32");
			stringRadioButton.setSelected(true);
			getFormatGroup().add(stringRadioButton);
		}
		return stringRadioButton;
	}
	
	private JRadioButton getHexRadioButton() {
		if(HexRadioButton == null) {
			HexRadioButton = new JRadioButton();
			HexRadioButton.setText("\u5341\u516d\u8fdb\u5236");
			getFormatGroup().add(HexRadioButton);
		}
		return HexRadioButton;
	}
	
	private JRadioButton getBinaryRadioButton() {
		if(BinaryRadioButton == null) {
			BinaryRadioButton = new JRadioButton();
			BinaryRadioButton.setText("\u4e8c\u8fdb\u5236");
			getFormatGroup().add(BinaryRadioButton);
		}
		return BinaryRadioButton;
	}
	
	private JTextArea getSentTextArea() {
		if(sentTextArea == null) {
			sentTextArea = new JTextArea();
		}
		return sentTextArea;
	}
	
	private JButton getSentButton() {
		if(SentButton == null) {
			SentButton = new JButton();
			SentButton.setText("Send");
		}
		return SentButton;
	}
	
	private JTextArea getReceiveDisplayTextArea() {
		if(receiveDisplayTextArea == null) {
			receiveDisplayTextArea = new JTextArea();
		}
		return receiveDisplayTextArea;
	}

}
